var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var a in e) e.hasOwnProperty(a) && (t[a] = e[a]);
    })(t, e);
}, function(t, e) {
    function a() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (a.prototype = e.prototype, 
    new a());
}), a = this && this.__decorate || function(t, e, a, n) {
    var i, o = arguments.length, r = o < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, a) : n;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, a, n); else for (var l = t.length - 1; 0 <= l; l--) (i = t[l]) && (r = (o < 3 ? i(r) : 3 < o ? i(e, a, r) : i(e, a)) || r);
    return 3 < o && r && Object.defineProperty(e, a, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("PopItemView"), s = e("HpView"), c = e("Global"), l = e("TimeView"), d = e("PetManager"), u = e("AudioManager"), p = e("PersonView"), h = e("GameData"), f = e("UIManager"), g = cc._decorator, m = g.ccclass, y = g.property, v = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.numLabel = null, t.hpView = null, t.vaildBtn = null, t.pet = null, t.time = null, 
        t.tipsLabel = null, t.nameLabel = null, t;
    }
    return i(t, e), t.prototype.onEnable = function() {
        var t = this;
        cc.tween(this.node).to(.1, {
            scale: 1.1
        }).to(.1, {
            scale: 1
        }).call(function() {}).start(), this.refresh();
        var e = d.default.getInstance().load(Date.now());
        0 < e && (this.time.node.active = !0, this.time.init(e), this.time.startTimer(), 
        this.time.node.on("finished", function() {
            t.time.node.off("finished"), t.callback();
        }, this));
    }, t.prototype.start = function() {
        e.prototype.start.call(this), this.pet.initPet(), this.nameLabel.string = d.default.getInstance().getConfig().m;
    }, t.prototype.callback = function() {
        this.time && (this.time.node.active = !1), c.G.chargeList[h.GD.petDataIdx] = 0, 
        d.default.getInstance().getRealData().hp = d.default.getInstance().getHp(h.GD.petDataIdx), 
        f.default.getInstance().petShows.forEach(function(t) {
            return t.refresh();
        }), this.refresh();
    }, t.prototype.refresh = function() {
        var t = d.default.getInstance().getRealHp(), e = d.default.getInstance().getHp();
        t / e < 1 ? (t / e < .3 ? (u.default.getInstance().playAudio("宠物" + (0 == h.GD.petDataIdx ? "狗叫2" : "龙点击充能2")), 
        this.tipsLabel.string = "能量不足 无法出战") : (u.default.getInstance().playAudio("宠物" + (0 == h.GD.petDataIdx ? "狗叫" : "龙点击充能1")), 
        this.tipsLabel.string = ""), this.vaildBtn.active = !1, this.myButton.init(this.text), 
        this.myButton.node.active = !0) : (u.default.getInstance().playAudio("宠物" + (0 == h.GD.petDataIdx ? "狗叫" : "龙点击充能1")), 
        this.tipsLabel.string = "能量满格 状态健康", this.vaildBtn.active = !0, this.myButton.node.active = !1), 
        this.hpView.init(e), this.hpView.refresh(t), this.numLabel.string = "能量          " + t + "/" + e;
    }, a([ y(cc.Label) ], t.prototype, "numLabel", void 0), a([ y(s.default) ], t.prototype, "hpView", void 0), 
    a([ y(cc.Node) ], t.prototype, "vaildBtn", void 0), a([ y(p.default) ], t.prototype, "pet", void 0), 
    a([ y(l.default) ], t.prototype, "time", void 0), a([ y(cc.Label) ], t.prototype, "tipsLabel", void 0), 
    a([ y(cc.Label) ], t.prototype, "nameLabel", void 0), a([ m ], t);
}(r.default);

n.default = v;